import axios from "@/assets/工具/网络请求"

// const getPicture = (pictureName:string):string => new URL(`http://localhost:8080/images/`,import.meta.url).href+'/'+pictureName
const getPicture = (pictureName: string): string => {
    const url = new URL(`${axios.url}images/${pictureName}`);
    return url.href;
};
const plusZero = (n:number) => n < 10 ? '0'+n : n
const getLocalStringDateTime = (normalDate:Date):string =>{
    const d = new Date(normalDate)
    return `${d.getFullYear()}-${plusZero(d.getMonth()+1)}-${plusZero(d.getDate())} ${plusZero(d.getHours())}:${plusZero(d.getSeconds())}`
}
const getLocalStringDate = (normalDate:Date):string =>{
    const d = new Date(normalDate)
    return `${d.getFullYear()}-${plusZero(d.getMonth()+1)}-${plusZero(d.getDate())}`
}

export {
    getPicture,getLocalStringDateTime,getLocalStringDate
}